package com.gdziarmaga.webshop.core.dao;

import java.util.List;

import com.gdziarmaga.webshop.utils.filtering.BaseFilter;
import com.gdziarmaga.webshop.utils.filtering.GenericFilter;
/**
 * Interface used by all entities to persisting and finding object in DB
 * @author GrzesiekD
 *
 * @param <T>
 * @param <PK>
 */
public interface GenericDao<T, PK extends java.io.Serializable> {
	/**
	 * Saving new object in DB
	 * @param object
	 * @return
	 */
    PK save(T object);
   
    /**
     * Saving/updating object in DB (depend on actual state)
     * @param object
     */
    void saveOrUpdate(T object);

    /**
     * Deleting object from DB
     * @param id
     */
    void delete(PK id);

    /**
     * Getting object from DB using primary key
     * @param id
     * @return
     */
    T getById(PK id);

    /**
     * Checking out object presence in DB  
     * @param id
     * @return
     */
    boolean exists(PK id);
    /**
     * Getting list all of the objects from DB
     * @return
     */
    List<T> getAll();
    
    
//    public List<T> getAll(final GenericFilter filter);
    
    public List<T> getAll(final BaseFilter filter);

        
    }


	
  